export function convertSecondToTime(number: number) {
  let hour = Math.floor(number / (60 * 60));
  let minute = Math.floor((number % (60 * 60)) / 60);
  let second = (number % (60 * 60)) % 60;

  let hourText = hour ? `${hour}小时` : "";
  let minuteText = minute ? `${minute}分钟` : "";
  let secondText = second ? `${second}秒` : "";
  let convertText =
    hourText || minuteText || secondText
      ? `（${hourText}${minuteText}${secondText}）`
      : "";
  let text = `${number}s${convertText}`;
  let conText = `${hourText}${minuteText}${secondText}`;
  return {
    hour,
    minute,
    second,
    text,
    conText,
  };
}

export function parseUrlParams(url: string) {
  // 创建URL对象
  const urlObj = new URL(url, window.location.origin);
  // 获取查询参数
  const params = new URLSearchParams(urlObj.search);

  // 转换为对象
  const result: any = {};
  for (const [key, value] of params) {
    result[key] = value;
  }

  return result;
}
